﻿<?php
/********************************************************
 *
 * 此文件的作用:
 *		员工表的入口
 *
 * @copyright Copyright (c) 2008-2009
 * @author 刘昌功 lcg635@126.com
 *
 ********************************************************/
defined('APP_DIR') or die('404 Not Found');

FLEA::loadClass('Common_Table');

class Table_Worker extends Common_Table {
    var $tableName = 'worker';
    var $primaryKey = 'user_id';

	function form($data = null,$data2 = null) {
		if($data2['group']==7 || $data2['group']==71 || $data2['group']==72 || $data2['group']==73 || $data2['group']==74 || $data2['group']==75 || $data2['group']==76 || $data2['group']==77 || $data2['group']==78 || $data2['group']==79)
			$group = 7;
		else $group =$data2['group'];
		$office = split('\|', $data2['office']);
		$this->_ui = FLEA::initWebControls();
		$form = array(
			'user_id' => $this->_ui->control('Hidden', 'user_id',
				array(
					'value' => $data['user_id']
				),
				true
			),			
			'number' => $this->_ui->control('Hidden', 'number',
				array(
					'value' => 'Q**@@@@**@'
				),
				true
			),
			'experience' => $this->_ui->control('Memo', 'experience',
				array(
					'value' => $data2['experience'],
					'check' => 'isLength(0,130);',
					'lenght' => 30,
					'cols' => 70,
					'rows' => 3
				),
				true
			),
			'trait' => $this->_ui->control('Memo', 'trait',
				array(
					'value' => $data2['trait'],
					'check' => 'isLength(0,130);',
					'cols' => 70,
					'rows' => 3
				),
				true
			),
			'like' => $this->_ui->control('Memo', 'like',
				array(
					'value' => $data2['like'],
					'check' => 'isLength(0,130);',
					'cols' => 70,
					'rows' => 3
				),
				true
			),
			'acqierement' => $this->_ui->control('Memo', 'acqierement',	//已改为参加勤助的理由，变量名未改
				array(
					'value' => $data2['acqierement'],
					'check' => 'isLength(0,130);',
					'cols' => 70,
					'rows' => 3
				),
				true
			),
			'memo' => $this->_ui->control('Memo', 'memo',
				array(
					'value' => $data2['memo'],
					'check' => 'isLength(0,130);',
					'cols' => 70,
					'rows' => 3
				),
				true
			),
			'birthday' => $this->_ui->control('Textbox', 'birthday',
				array(
					'required' => 'true',
					'value' => $data2['birthday'],
					'check' => 'isDate(\'YYYY-MM-DD\');',
					'showName' => '出生日期'
				),
				true
			),
			'group' => $this->_ui->control('RadioGroup', 'group',
				array(
					'items' => array(
						'课室服务组' => 1,
						'饭堂服务组' => 2,
						'多媒体教室管理组' => 3,
						//'粤港澳青年交流中心' => 4,
						'金陵四广场管理组' => 9,
						//'机关部处' => 21,
						'学生活动中心管理组' => 5,
						'建阳服务组' => 6,
						//'图书馆' => 7
					),
					'required' => 'true',
					'showName' => '选项“希望参加何种工作”',
					'cols' => 7,
					//'table' => true,
					'selected' => $group
				),
				true
			),
			/*'office' => $this->_ui->control('CheckboxGroup', 'office',
				array(
					'items' => array(
						'执行副助理' =>20,
						//'物业服务部' => 21,
						//'综合服务部' => 22,
						'推广部' => 26,
						'市场部' => 23,
						'财务部' => 24,
						'人力部' => 25
					),
					//'required' => 'true',
					//'showName' => '选项“希望参加何种工作”',
					//'cols' => 7,
					//'table' => true,
					'selected' => $office,
					'onClick' => 'doCheck(this)'
				),
				true
			),			
			'lib' => $this->_ui->control('DropdownList', 'lib',
				array(
					'items' => array(
						'请选择图书馆具体职位：'=>'',
						//'图示馆文献服务部' => 71,
						//'图书馆前台、新书区、期刊' =>72,
						//'图书馆二线服务部门：办公室、华人中心、技术部、采访编目部' => 73,
						//'图书馆搬迁小组' => 74,
						'流通部' => 71,
						'办公室' => 72,
						'阅览部' => 73,
						'华人中心' => 74,
						'采编部' => 75,
						'技术部' => 76,
						'总服务台' => 77,
						'古籍室' => 78,
						'期刊现报' => 79
						
					),
					'showName' => '图书馆具体职位',
					'selected' => $data2['group']
				),
				true
			),*/
/*			'change' => $this->_ui->control('Checkbox', 'change',
				array(
					//'value' => 1
				),
				true
			),*/
			'oldwork' => $this->_ui->control('Memo', 'oldwork',
				array(
					//'value' => '上岗时间：　　部门：　　岗位：　　下岗时间：　　备注：',
					'value' => $data2['oldwork'],
					//'style' => 'width:550px;',
					//'onclick' => 'showOldWork()',
					'cols' => 70,
					'rows' => 3
				),
				true
			),
			'home' => $this->_ui->control('Textbox', 'home',
				array(
					'required' => 'true',
					'value' =>$data2['home'],
					'class' => 'input_box01',
					'showName' => '家庭住址',
					'size' => '50',
					'maxlength' => '20'
				),
				true
			),
			'family' => $this->_ui->control('RadioGroup', 'family',
				array(
					'items' => array('困难' => 0, '一般' => 1, '较好' => 2),
					'selected' => $data2['family']
				),
				true
			)
		);

		return $form;
	}

	function searchForm() {
		$this->_ui = FLEA::initWebControls();
		$form = array(
			'trueName' => $this->_ui->control('Textbox', 'trueName',
				array(
					'required' => 'true',
					'check' => 'onlyZh',
					'class' => 'input_box01',
					'showName' => '真实姓名'
				),
				true
			),	
			'province' => $this->_ui->control('DropdownList', 'province',
				array(
					'required' => 'true',
					'check' => 'notBlank',
					'showName' => '籍贯',
					'items' => array('请选择' => '',
								   	'北京' => '北京',
						              '上海' => '上海',
						              '天津' => '天津',
						              '重庆' => '重庆',
						              '河北' => '河北',
						              '山西' => '山西',
						              '辽宁' => '辽宁',
						              '吉林' => '吉林',
						              '黑龙江' => '黑龙江',
						              '江苏' => '江苏',
						              '浙江' => '浙江',
						              '安徽' => '安徽',
						              '福建' => '福建',
						              '江西' => '江西',
						              '山东' => '山东',
						              '河南' => '河南',
						              '湖北' => '湖北',
						              '湖南' => '湖南',
						              '广东' => '广东',
						              '海南' => '海南',
						              '四川' => '四川',
						              '贵州' => '贵州',
						              '云南' => '云南',
						              '陕西' => '陕西',
						              '甘肃' => '甘肃',
						              '青海' => '青海',
						              '内蒙古' => '内蒙古',
						              '广西' => '广西区',
						              '西藏' => '西藏',
						              '宁夏' => '宁夏',
						              '新疆' => '新疆',
						              '台湾' => '台湾',
						              '香港' => '香港',
						              '澳门' => '澳门',
						              '国外' => '国外',
									)
				),
				true
			),
			'province2' => $this->_ui->control('Textbox', 'province2',
				array(
					'required' => 'true',
					'class' => 'input_box01',
					'showName' => '籍贯文本框',
				),
				true
			),	
			'userType' => $this->_ui->control('DropdownList', 'userType',
				array(
					'items' => array('请选择:'=> '-1','本科'=>0, '研究生'=>1, '博士' => 2),
					'selected' => '-1'
				),
				true
			),
			'college' => $this->_ui->control('DropdownList', 'college',
				array(
					'required' => 'true',
					'check' => 'notBlank',
					'class' => 'input_box01',
					'showName' => '学院',
					'onChange' => 'selectDepartment()',
					'items' => array('请选择：'=>'')
				),
				true
			),			
			'college2' => $this->_ui->control('Textbox', 'college2',
				array(
					'required' => 'true',
					'class' => 'input_box01',
					'showName' => '学院文本框',
				),
				true
			),			
			'department' => $this->_ui->control('DropdownList', 'department',
				array(
					'required' => 'true',
					'check' => 'notBlank',
					'class' => 'input_box01',
					'showName' => '系',
					'onChange' => 'selectMajor()',
					'items' => array('请选择：'=>'')
				),
				true
			),
			'department2' => $this->_ui->control('Textbox', 'department2',
				array(
					'required' => 'true',
					'class' => 'input_box01',
					'showName' => '系文本框',
				),
				true
			),
			'major' => $this->_ui->control('DropdownList', 'major',
				array(
					'required' => 'true',
					'check' => 'notBlank',
					'class' => 'input_box01',
					'showName' => '专业',
					'items' => array('请选择：'=>'')

				),
				true
			),
			'major2' => $this->_ui->control('Textbox', 'major2',
				array(
					'required' => 'true',
					'class' => 'input_box01',
					'showName' => '专业文本框',
				),
				true
			),
			'group' => $this->_ui->control('DropdownList', 'group',
				array(
					'required' => 'true',
					'class' => 'input_box01',
					'showName' => '部门',
					'items' => array(
					'请选择：'=>'',
					'管委会办公室助理' => 8,
					'课室服务组' => 1,
					'饭堂服务组' => 2,
					'多媒体教室管理组' => 3,
					'金四管理组' => 9,
					//'粤港澳青年交流中心' => 4,
					'学生活动中心管理组' => 5,
					'建阳服务组' => 6,
					//'图书馆' => 7,
					'机关部处' => 21,
					'图示馆文献服务部' => 71,
					'图书馆前台、新书区、期刊'=> 72, 
					'图书馆二线服务部门' =>73 ,//图书馆二线服务部门：办公室、华人中心、技术部、采访编目部
					'图书馆搬迁小组' => 74
					)
				),
				true
			),
	
			'office' => $this->_ui->control('DropdownList', 'office',
				array(
					'required' => 'true',
					'class' => 'input_box01',
					'showName' => '办公室',
					'items' => array(
						'请选择：'=>'',
						'物业服务部' => 10,
						'综合服务部' =>20,
						'市场部' => 30,
						'财务部' => 40,
						'人力部' => 50,
						'推广部' => 60
						)

				),
				true
			),
			'poor' => $this->_ui->control('DropdownList', 'poor',
				array(
					'required' => 'true',
					'items' => array( '是' => 1,'否' => 0,'请选择' => -1),
					'selected' => -1
				),
				true
			),
			'startDate' => $this->_ui->control('Textbox', 'startDate',
				array(
					'required' => 'true',
					'value' => '2008-09-01',
					'class' => 'input_box01',
					'showName' => '开始报名日期',
				),
				true
			),
			'endDate' => $this->_ui->control('Textbox', 'endDate',
				array(
					'required' => 'true',
					'value' => '2008-09-30',
					'class' => 'input_box01',
					'showName' => '开始结束日期',
				),
				true
			),
			'zhenghe' => $this->_ui->control('Textbox', 'zhenghe',
				array(
					'required' => 'true',
					'class' => 'input_box01',
					'showName' => '整合搜索'
				),
				true
			)
		);

		return $form;
	}
	
	function connectForm($data = null) {
		$this->_ui = FLEA::initWebControls();
		$form = array(
			'connect' => $this->_ui->control('Hidden', 'connect',
				array(
					'value' => $data
				),
				true
			),	
		);

		return $form;
	}

}
